

var fs = require('fs')
const dirCache={};
function writeFileByUser(filePath){
    if (!fs.existsSync(filePath)) mkdir(filePath); 
}

function mkdir(filePath) {
    const arr=filePath.split('/');
    let dir=arr[0];
    for(let i=1;i<arr.length;i++){
        if(!dirCache[dir]&&!fs.existsSync(dir)){
            dirCache[dir]=true;
            fs.mkdirSync(dir);
        }
        dir=dir+'/'+arr[i];
    }
    fs.writeFileSync(filePath, '')
}


/*
页面列表,组件列表
*/
"search,near,care,detail,publish,well".split(",").map(e=>{
  writeFileByUser('./pages/'+ e.trim() +'/index.vue');	
  writeFileByUser('./pages/'+ e.trim() +'/core/item.vue');	
}) 

